<template>
  <div>
      <!-- <div>当前最新的count：{{count}}</div> -->
      <h3>{{showNum}}</h3>
      <button @click="btnHandler1">-1</button>
      <button @click="btnHandler2">-n</button>
      <button @click="subAsync">延迟-1</button>
      <button @click="subNAsync(5)">延迟-n</button>
  </div>
</template>

<script>
import {mapState , mapMutations, mapActions, mapGetters } from 'vuex'
export default {
    data(){
      return {}
    },
    computed:{
      ...mapState(['count']),
      ...mapGetters(['showNum'])
    },
    methods: {
      ...mapMutations(['sub', 'subN']),
      ...mapActions(['subAsync', 'subNAsync']),
      btnHandler1(){
        this.sub()
      },
      btnHandler2(){
        this.subN(4)
      },
    }
}

</script>
<style scoped>
</style>